package com.crm.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.crm.common.ResVo;
import com.crm.entity.HomePageChart;
import com.crm.service.HomePageChartService;
import com.spring4all.swagger.EnableSwagger2Doc;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@EnableSwagger2Doc
@RequestMapping("/homePageChart")
@Api(tags = "轮播图管理")
public class HomePageChartController{
	
	@Autowired
	private HomePageChartService homePageChartService;
	
	@GetMapping("/getLunbo")
	@ApiOperation("获取有效的轮播图")
	public ResVo<Object> getHomePageChart() {
		List<HomePageChart> message = homePageChartService.findHomePageChart();
		return ResVo.success(message);
	}
	
	@PostMapping("/addHomePageChart")
	@ApiOperation("添加轮播图")
	public ResVo<Object> addHomePageChart(@RequestBody HomePageChart homePageChart) {
		homePageChartService.addHomePageChart(homePageChart);
		return ResVo.defaultSuccess();
	}
	
	

}
